<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/support/taglibs.jsp" %>


<stripes:layout-render name="/support/layout/standard.jsp" title="Edit/Add Organization" page="organizations">
<stripes:layout-component name="contents">
<stripes:errors/>
<jsp:useBean id="isernManager" scope="page"
           class="edu.hawaii.myisern.model.IsernManager"/>
           
<stripes:form action="/OrganizationForm.action" id="MyForm">

 <table class="leftRightForm">
                <tr>
                    <th>ID:</th>
                    <td>${empty actionBean.id ? "n/a" : actionBean.id}
                        <stripes:hidden name="id"/>
                    </td>
                 </tr>
                 <tr>
                    <th>Name:</th>
                    <td><stripes:text name="organization.name"  />
                    </td>                 
                 </tr>
                 <tr>
                    <th>Type:</th>
                    <td>
                       <stripes:select name="organization.type">
                            <stripes:options-collection collection="${isernManager.organizationTypes}" />
                        </stripes:select>

                    </td>                 
                 </tr>
                 <tr>
                    <th>Contact:</th>
                    <td>
                        <stripes:select name="organization.contact">
                        	<option value="${actionBean.organization.contact}">${actionBean.organization.contact}</option>
                        	<c:forEach items="${actionBean.organization.affiliatedResearchers.affiliatedResearcher}" var="affiliatedResearcher" varStatus="loop">
                        		<option value="${affiliatedResearcher}">${affiliatedResearcher}</option>
                        	</c:forEach>
                        </stripes:select>
                    </td>                 
                 </tr>
                 <tr>
                    <th>Country:</th>
                    <td><stripes:text name="organization.country"  />
                    </td>                 
                 </tr>
                 <tr>
                    <th>Home Page:</th>
                    <td><stripes:text name="organization.homePage"  />
                    </td>                 
                 </tr>
                 <tr>
                    <th>Research Description:</th>
                    <td><stripes:textarea name="organization.researchDescription"  />
                    </td>                 
                 </tr>                                                                                
            </table> 
            
            <div class="buttons">
                <stripes:submit name="save" value="Save"/>
                <stripes:submit name="remove" value="Remove" onclick="return confirm('Are you sure you want to remove Organization ${actionBean.organization.name}?')"/>
            </div>
           </stripes:form>
           
    </stripes:layout-component>
</stripes:layout-render>
